package com.chuangke.file.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.common.http.HttpResult;
import com.chuangke.file.service.FileCategoryService;

@RestController
@RequestMapping("filecategory")
public class FileCategoryController {

	@Autowired
	private FileCategoryService fileCategoryService;

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping("/allcategory")
	public HttpResult listAllCategory() {
		return HttpResult.ok(fileCategoryService.listAllCategory());
	}

	@PreAuthorize("hasAuthority('login:action')")
	@GetMapping(value = "/deptcategory/{dbankId}")
	public HttpResult listDeptCategory(@PathVariable String dbankId) {
		return HttpResult.ok(fileCategoryService.listCategoryByDbankId(dbankId));
	}

}
